package a.jframe;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;

import javax.swing.DefaultListModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class Lab extends BASEFRAME{
	
	List<String> commandsList=new ArrayList<String>();
	final  JDesktopPane paneld=new JDesktopPane();
	public Lab(){
		jframe=0;
		list_();
		createpanel();
		pack();
		setVisible(true);
	}
	void createpanel(){
		JPanel login= new JPanel();
		JLabel a=new JLabel("Nazwa polecenia :");
		JLabel a1=new JLabel("Polecenie :");
		JLabel a2=new JLabel("Lista polecen:");
		JLabel emptylabel=new JLabel(" ");
		JList aa2=new JList();
		JButton saveNewCommand=new JButton("Save");
		JButton openinternalframe=new JButton("Open");
		saveNewCommand.addActionListener(new ActionListenerPanel("savenewcommand"));
		openinternalframe.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				JInternalFrame in=new JInternalFrame("p",true, true, true, true);
				paneld.add(in);in.moveToFront();
			}
		});
		GridLayout gl=new GridLayout(0,2);
		GridLayout g2=new GridLayout(4,0);
		fieldWithCommandName.setPreferredSize(new Dimension(80,20));
		fieldWithSyntaxOfCommand.setPreferredSize(new Dimension(80,20));
		
		JPanel pane = new JPanel(gl);
		JPanel pane2 = new JPanel(g2);
		GroupLayout layout = new GroupLayout(pane2);
		pane2.setLayout(g2);
		pane2.add(a2, g2);
		pane2.add(emptylabel, g2);
		pane2.add( scrollPane,g2);
		pane2.add(saveNewCommand,g2);
		pane.setSize(100,350);
		pane.add(a, gl);pane.add(fieldWithCommandName, gl);
		pane.add(a1, gl);pane.add(fieldWithSyntaxOfCommand, gl);
		pane.add(openinternalframe,g2);
		getContentPane().add(pane,BorderLayout.PAGE_START);
		getContentPane().add(pane2,BorderLayout.CENTER);
		setPreferredSize(new Dimension(500,400));
		paneld.setPreferredSize(new Dimension(200,200));
		paneld.setBackground(Color.BLACK);
		getContentPane().add(openinternalframe,BorderLayout.PAGE_START);
		getContentPane().add(paneld,BorderLayout.CENTER);
		JInternalFrame in=new JInternalFrame("p",true, true, true, true);
		in.setVisible(true); //necessary as of 1.3
		try {
			in.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {}
		paneld.add(in);
		zamykanie();
	}
	
	
	

}
